package com.example.chronicdisease.controller;

import com.example.chronicdisease.pojo.CiReport;
import com.example.chronicdisease.pojo.Orders;
import com.example.chronicdisease.service.CiReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController  // @Controller  +  @ResponseBody
@RequestMapping("/ciReport")
public class CiReportController {

    @Autowired
    private CiReportService ciReportService;


    @RequestMapping("/createReportTemplate")
    public int createReportTemplate(@RequestBody Orders orders) {

        System.out.println("/createReportTemplate"+orders);
        Integer integer=ciReportService.createReportTemplate(orders);
        System.out.println("是否成功生成表："+integer);
        return ciReportService.createReportTemplate(orders);
    }

    @RequestMapping("/listCiReport")
    public List<CiReport> listCiReport(@RequestBody CiReport ciReport) {
        System.out.println("/listCiReport"+ciReport);
        return ciReportService.listCiReport(ciReport.getOrderId());
    }
}
